﻿using System;
using System.Collections.Generic;
using System.Linq;
using Helpers;
using TaleWorlds.CampaignSystem.Actions;
using TaleWorlds.CampaignSystem.CharacterDevelopment;
using TaleWorlds.CampaignSystem.ComponentInterfaces;
using TaleWorlds.CampaignSystem.Conversation;
using TaleWorlds.CampaignSystem.Encounters;
using TaleWorlds.CampaignSystem.Extensions;
using TaleWorlds.CampaignSystem.GameMenus;
using TaleWorlds.CampaignSystem.Map;
using TaleWorlds.CampaignSystem.MapEvents;
using TaleWorlds.CampaignSystem.Party;
using TaleWorlds.CampaignSystem.Party.PartyComponents;
using TaleWorlds.CampaignSystem.Roster;
using TaleWorlds.CampaignSystem.Settlements;
using TaleWorlds.Core;
using TaleWorlds.Library;
using TaleWorlds.Localization;
using TaleWorlds.ObjectSystem;
using TaleWorlds.SaveSystem;

namespace TaleWorlds.CampaignSystem.Issues
{
	// Token: 0x02000303 RID: 771
	public class ExtortionByDesertersIssueBehavior : CampaignBehaviorBase
	{
		// Token: 0x06002D01 RID: 11521 RVA: 0x000BCB14 File Offset: 0x000BAD14
		private void OnCheckForIssue(Hero hero)
		{
			if (this.ConditionsHold(hero))
			{
				Campaign.Current.IssueManager.AddPotentialIssueData(hero, new PotentialIssueData(new PotentialIssueData.StartIssueDelegate(this.OnIssueSelected), typeof(ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssue), IssueBase.IssueFrequency.Common, null));
				return;
			}
			Campaign.Current.IssueManager.AddPotentialIssueData(hero, new PotentialIssueData(typeof(ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssue), IssueBase.IssueFrequency.Common));
		}

		// Token: 0x06002D02 RID: 11522 RVA: 0x000BCB78 File Offset: 0x000BAD78
		private IssueBase OnIssueSelected(in PotentialIssueData pid, Hero issueOwner)
		{
			return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssue(issueOwner);
		}

		// Token: 0x06002D03 RID: 11523 RVA: 0x000BCB80 File Offset: 0x000BAD80
		private bool ConditionsHold(Hero issueGiver)
		{
			if (issueGiver.IsHeadman)
			{
				Settlement currentSettlement = issueGiver.CurrentSettlement;
				if (currentSettlement.IsVillage && currentSettlement.Culture != null)
				{
					Settlement bound = currentSettlement.Village.Bound;
					Town town = (bound != null) ? bound.Town : null;
					if (town != null)
					{
						return town.Security <= 50f;
					}
				}
			}
			return false;
		}

		// Token: 0x06002D04 RID: 11524 RVA: 0x000BCBD9 File Offset: 0x000BADD9
		public override void RegisterEvents()
		{
			CampaignEvents.OnCheckForIssueEvent.AddNonSerializedListener(this, new Action<Hero>(this.OnCheckForIssue));
		}

		// Token: 0x06002D05 RID: 11525 RVA: 0x000BCBF2 File Offset: 0x000BADF2
		public override void SyncData(IDataStore dataStore)
		{
		}

		// Token: 0x04000D7E RID: 3454
		private const IssueBase.IssueFrequency ExtortionByDesertersIssueFrequency = IssueBase.IssueFrequency.Common;

		// Token: 0x02000619 RID: 1561
		public class ExtortionByDesertersIssue : IssueBase
		{
			// Token: 0x06004A89 RID: 19081 RVA: 0x00158393 File Offset: 0x00156593
			internal static void AutoGeneratedStaticCollectObjectsExtortionByDesertersIssue(object o, List<object> collectedObjects)
			{
				((ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssue)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x06004A8A RID: 19082 RVA: 0x001583A1 File Offset: 0x001565A1
			protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
			{
				base.AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x17000EE2 RID: 3810
			// (get) Token: 0x06004A8B RID: 19083 RVA: 0x001583AA File Offset: 0x001565AA
			public override IssueBase.AlternativeSolutionScaleFlag AlternativeSolutionScaleFlags
			{
				get
				{
					return IssueBase.AlternativeSolutionScaleFlag.Casualties | IssueBase.AlternativeSolutionScaleFlag.FailureRisk;
				}
			}

			// Token: 0x17000EE3 RID: 3811
			// (get) Token: 0x06004A8C RID: 19084 RVA: 0x001583AE File Offset: 0x001565AE
			protected override int CompanionSkillRewardXP
			{
				get
				{
					return (int)(800f + 1000f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17000EE4 RID: 3812
			// (get) Token: 0x06004A8D RID: 19085 RVA: 0x001583C4 File Offset: 0x001565C4
			public override TextObject IssueBriefByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=NhDEwaab}Well, if you know how to fight... Yes, we could use help. A group of deserters is camped out near here. They come every few weeks, demanding food and money. They've killed two villagers who resisted them. We asked our {?LORD.GENDER}mistress{?}lord{\\?}, {LORD.NAME}, for help but {?LORD.GENDER}her{?}his{\\?} men never get here in time.[if:convo_stern][ib:closed]", null);
					StringHelpers.SetCharacterProperties("LORD", base.IssueSettlement.OwnerClan.Leader.CharacterObject, textObject, false);
					if (base.IssueSettlement.OwnerClan.Leader == Hero.MainHero)
					{
						textObject = new TextObject("{=dYO8piOM}Yes, my {?PLAYER.GENDER}lady{?}lord{\\?}. It is good of you to ask. A group of deserters is camped out near here. They come every few weeks, demanding food and money. They've killed two villagers who resisted them.[if:convo_stern][ib:closed]", null);
					}
					return textObject;
				}
			}

			// Token: 0x17000EE5 RID: 3813
			// (get) Token: 0x06004A8E RID: 19086 RVA: 0x00158423 File Offset: 0x00156623
			public override TextObject IssueAcceptByPlayer
			{
				get
				{
					return new TextObject("{=WO3EaqB3}How can I help you?", null);
				}
			}

			// Token: 0x17000EE6 RID: 3814
			// (get) Token: 0x06004A8F RID: 19087 RVA: 0x00158430 File Offset: 0x00156630
			public override TextObject IssueQuestSolutionExplanationByIssueGiver
			{
				get
				{
					return new TextObject("{=tb0gqxDZ}Here's the plan. We lay an ambush in the village. When they show up, we spring. If you join us, I think we've got a good chance of ridding ourselves of this scourge before they murder us one by one.[if:convo_stern][ib:normal]", null);
				}
			}

			// Token: 0x17000EE7 RID: 3815
			// (get) Token: 0x06004A90 RID: 19088 RVA: 0x0015843D File Offset: 0x0015663D
			public override TextObject IssueQuestSolutionAcceptByPlayer
			{
				get
				{
					return new TextObject("{=vKxiFQRA}All right. I'll wait here and join you in your fight.", null);
				}
			}

			// Token: 0x17000EE8 RID: 3816
			// (get) Token: 0x06004A91 RID: 19089 RVA: 0x0015844A File Offset: 0x0015664A
			public override TextObject IssueAlternativeSolutionSuccessLog
			{
				get
				{
					TextObject textObject = new TextObject("{=CLvxAzyV}Following your orders, {COMPANION.LINK} and your men has defeated the deserters and saved the people of {SETTLEMENT}.", null);
					textObject.SetTextVariable("SETTLEMENT", base.IssueSettlement.EncyclopediaLinkWithName);
					textObject.SetCharacterProperties("COMPANION", base.AlternativeSolutionHero.CharacterObject, false);
					return textObject;
				}
			}

			// Token: 0x17000EE9 RID: 3817
			// (get) Token: 0x06004A92 RID: 19090 RVA: 0x00158485 File Offset: 0x00156685
			public override bool IsThereAlternativeSolution
			{
				get
				{
					return true;
				}
			}

			// Token: 0x17000EEA RID: 3818
			// (get) Token: 0x06004A93 RID: 19091 RVA: 0x00158488 File Offset: 0x00156688
			public override int AlternativeSolutionBaseNeededMenCount
			{
				get
				{
					return 21 + MathF.Ceiling(25f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17000EEB RID: 3819
			// (get) Token: 0x06004A94 RID: 19092 RVA: 0x0015849E File Offset: 0x0015669E
			protected override int AlternativeSolutionBaseDurationInDaysInternal
			{
				get
				{
					return 3 + MathF.Ceiling(5f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17000EEC RID: 3820
			// (get) Token: 0x06004A95 RID: 19093 RVA: 0x001584B3 File Offset: 0x001566B3
			protected override int RewardGold
			{
				get
				{
					return 800 + MathF.Ceiling(4200f * base.IssueDifficultyMultiplier);
				}
			}

			// Token: 0x17000EED RID: 3821
			// (get) Token: 0x06004A96 RID: 19094 RVA: 0x001584CC File Offset: 0x001566CC
			public override TextObject IssueAlternativeSolutionExplanationByIssueGiver
			{
				get
				{
					TextObject textObject = new TextObject("{=J0Clb1RD}If you don't have the time, at least send one of your best companions with {TROOP_COUNT} experienced men for {RETURN_DAYS} days.[if:convo_stern][ib:closed]", null);
					textObject.SetTextVariable("TROOP_COUNT", base.GetTotalAlternativeSolutionNeededMenCount());
					textObject.SetTextVariable("RETURN_DAYS", base.GetTotalAlternativeSolutionDurationInDays());
					return textObject;
				}
			}

			// Token: 0x17000EEE RID: 3822
			// (get) Token: 0x06004A97 RID: 19095 RVA: 0x001584FD File Offset: 0x001566FD
			public override TextObject IssueAlternativeSolutionAcceptByPlayer
			{
				get
				{
					return new TextObject("{=A4oWozvO}I don't have time for this, but my companion and my men will wait here with you.", null);
				}
			}

			// Token: 0x17000EEF RID: 3823
			// (get) Token: 0x06004A98 RID: 19096 RVA: 0x0015850A File Offset: 0x0015670A
			public override TextObject IssueDiscussAlternativeSolution
			{
				get
				{
					return new TextObject("{=YwMMZFSm}We're working with your men to plan the ambush, {?PLAYER.GENDER}madam{?}sir{\\?}. These thieves will regret the day they ever thought we were easy pickings.", null);
				}
			}

			// Token: 0x17000EF0 RID: 3824
			// (get) Token: 0x06004A99 RID: 19097 RVA: 0x00158517 File Offset: 0x00156717
			public override TextObject IssueAlternativeSolutionResponseByIssueGiver
			{
				get
				{
					return new TextObject("{=OLcbuZSa}Thank you. Your help is much appreciated.", null);
				}
			}

			// Token: 0x17000EF1 RID: 3825
			// (get) Token: 0x06004A9A RID: 19098 RVA: 0x00158524 File Offset: 0x00156724
			protected override TextObject AlternativeSolutionStartLog
			{
				get
				{
					TextObject textObject = new TextObject("{=MTVhHmbb}{ISSUE_GIVER.LINK} told you that a group of deserters have been raiding their village regularly. You asked your companion {COMPANION.LINK} to take {TROOP_COUNT} men to stay with {ISSUE_GIVER.LINK} and defend the people of {ISSUE_SETTLEMENT}.", null);
					StringHelpers.SetCharacterProperties("ISSUE_GIVER", base.IssueOwner.CharacterObject, textObject, false);
					StringHelpers.SetCharacterProperties("COMPANION", base.AlternativeSolutionHero.CharacterObject, textObject, false);
					textObject.SetTextVariable("ISSUE_SETTLEMENT", base.IssueSettlement.Name);
					textObject.SetTextVariable("TROOP_COUNT", this.AlternativeSolutionSentTroops.TotalManCount - 1);
					return textObject;
				}
			}

			// Token: 0x17000EF2 RID: 3826
			// (get) Token: 0x06004A9B RID: 19099 RVA: 0x0015859E File Offset: 0x0015679E
			public override bool IsThereLordSolution
			{
				get
				{
					return false;
				}
			}

			// Token: 0x06004A9C RID: 19100 RVA: 0x001585A1 File Offset: 0x001567A1
			public override bool DoTroopsSatisfyAlternativeSolution(TroopRoster troopRoster, out TextObject explanation)
			{
				explanation = TextObject.Empty;
				return QuestHelper.CheckRosterForAlternativeSolution(troopRoster, base.GetTotalAlternativeSolutionNeededMenCount(), ref explanation, 2, false);
			}

			// Token: 0x06004A9D RID: 19101 RVA: 0x001585B9 File Offset: 0x001567B9
			public override bool AlternativeSolutionCondition(out TextObject explanation)
			{
				explanation = TextObject.Empty;
				return QuestHelper.CheckRosterForAlternativeSolution(MobileParty.MainParty.MemberRoster, base.GetTotalAlternativeSolutionNeededMenCount(), ref explanation, 2, false);
			}

			// Token: 0x06004A9E RID: 19102 RVA: 0x001585DA File Offset: 0x001567DA
			public override bool IsTroopTypeNeededByAlternativeSolution(CharacterObject character)
			{
				return character.Tier >= 2;
			}

			// Token: 0x06004A9F RID: 19103 RVA: 0x001585E8 File Offset: 0x001567E8
			protected override void AlternativeSolutionEndWithSuccessConsequence()
			{
				this.RelationshipChangeWithIssueOwner = 8;
				base.IssueOwner.AddPower(15f);
				base.IssueSettlement.Village.Bound.Town.Security += 10f;
				base.IssueSettlement.Village.Bound.Town.Prosperity += 100f;
				TraitLevelingHelper.OnIssueSolvedThroughQuest(base.IssueOwner, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, 60)
				});
			}

			// Token: 0x06004AA0 RID: 19104 RVA: 0x00158678 File Offset: 0x00156878
			protected override void AlternativeSolutionEndWithFailureConsequence()
			{
				base.IssueSettlement.Village.Bound.Town.Security += -10f;
				base.IssueSettlement.Village.Bound.Town.Prosperity += -50f;
				this.RelationshipChangeWithIssueOwner = -10;
				base.IssueOwner.AddPower(-10f);
				TraitLevelingHelper.OnIssueFailed(base.IssueOwner, new Tuple<TraitObject, int>[]
				{
					new Tuple<TraitObject, int>(DefaultTraits.Honor, -20)
				});
			}

			// Token: 0x06004AA1 RID: 19105 RVA: 0x00158709 File Offset: 0x00156909
			protected override void OnGameLoad()
			{
			}

			// Token: 0x06004AA2 RID: 19106 RVA: 0x0015870B File Offset: 0x0015690B
			protected override void HourlyTick()
			{
			}

			// Token: 0x06004AA3 RID: 19107 RVA: 0x0015870D File Offset: 0x0015690D
			protected override QuestBase GenerateIssueQuest(string questId)
			{
				return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest(questId, base.IssueOwner, base.IssueDifficultyMultiplier, this.RewardGold, CampaignTime.DaysFromNow(12f));
			}

			// Token: 0x06004AA4 RID: 19108 RVA: 0x00158731 File Offset: 0x00156931
			public override IssueBase.IssueFrequency GetFrequency()
			{
				return IssueBase.IssueFrequency.Common;
			}

			// Token: 0x06004AA5 RID: 19109 RVA: 0x00158734 File Offset: 0x00156934
			protected override bool CanPlayerTakeQuestConditions(Hero issueGiver, out IssueBase.PreconditionFlags flag, out Hero relationHero, out SkillObject skill)
			{
				flag = IssueBase.PreconditionFlags.None;
				skill = null;
				relationHero = null;
				if (issueGiver.GetRelationWithPlayer() < -10f)
				{
					relationHero = issueGiver;
					flag |= IssueBase.PreconditionFlags.Relation;
				}
				Settlement currentSettlement = issueGiver.CurrentSettlement;
				if (currentSettlement != null && FactionManager.IsAtWarAgainstFaction(currentSettlement.MapFaction, Hero.MainHero.MapFaction))
				{
					flag |= IssueBase.PreconditionFlags.AtWar;
				}
				if (MobileParty.MainParty.MemberRoster.TotalHealthyCount < 20)
				{
					flag |= IssueBase.PreconditionFlags.NotEnoughTroops;
				}
				return flag == IssueBase.PreconditionFlags.None;
			}

			// Token: 0x06004AA6 RID: 19110 RVA: 0x001587AB File Offset: 0x001569AB
			protected override void CompleteIssueWithTimedOutConsequences()
			{
			}

			// Token: 0x06004AA7 RID: 19111 RVA: 0x001587B0 File Offset: 0x001569B0
			public override bool IssueStayAliveConditions()
			{
				return base.IssueSettlement.Village.Bound.Town.Security <= 80f && !base.IssueOwner.CurrentSettlement.IsRaided && !base.IssueOwner.CurrentSettlement.IsUnderRaid;
			}

			// Token: 0x17000EF3 RID: 3827
			// (get) Token: 0x06004AA8 RID: 19112 RVA: 0x00158805 File Offset: 0x00156A05
			public override TextObject Title
			{
				get
				{
					TextObject textObject = new TextObject("{=P2VNGJDa}Extortion by Deserters at {SETTLEMENT}", null);
					textObject.SetTextVariable("SETTLEMENT", base.IssueSettlement.Name);
					return textObject;
				}
			}

			// Token: 0x17000EF4 RID: 3828
			// (get) Token: 0x06004AA9 RID: 19113 RVA: 0x00158829 File Offset: 0x00156A29
			public override TextObject Description
			{
				get
				{
					TextObject textObject = new TextObject("{=atk3PTae}Deserters are extorting from the villagers of {SETTLEMENT} and have killed several who resisted.", null);
					textObject.SetTextVariable("SETTLEMENT", base.IssueSettlement.Name);
					return textObject;
				}
			}

			// Token: 0x17000EF5 RID: 3829
			// (get) Token: 0x06004AAA RID: 19114 RVA: 0x00158850 File Offset: 0x00156A50
			public override TextObject IssueAsRumorInSettlement
			{
				get
				{
					TextObject textObject = new TextObject("{=Fv8CKNU2}I hope {QUEST_GIVER.NAME} knows what {?QUEST_GIVER.GENDER}she's{?}he's{\\?} doing with that plan to get rid of the deserters.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.IssueOwner.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x06004AAB RID: 19115 RVA: 0x00158882 File Offset: 0x00156A82
			public ExtortionByDesertersIssue(Hero issueOwner) : base(issueOwner, CampaignTime.DaysFromNow(15f))
			{
			}

			// Token: 0x06004AAC RID: 19116 RVA: 0x00158895 File Offset: 0x00156A95
			protected override float GetIssueEffectAmountInternal(IssueEffect issueEffect)
			{
				if (issueEffect == DefaultIssueEffects.SettlementProsperity)
				{
					return -1f;
				}
				if (issueEffect == DefaultIssueEffects.SettlementSecurity)
				{
					return -1f;
				}
				if (issueEffect == DefaultIssueEffects.SettlementLoyalty)
				{
					return -0.5f;
				}
				return 0f;
			}

			// Token: 0x06004AAD RID: 19117 RVA: 0x001588C8 File Offset: 0x00156AC8
			public override ValueTuple<SkillObject, int> GetAlternativeSolutionSkill(Hero hero)
			{
				int skillValue = hero.GetSkillValue(DefaultSkills.Bow);
				int skillValue2 = hero.GetSkillValue(DefaultSkills.Crossbow);
				int skillValue3 = hero.GetSkillValue(DefaultSkills.Throwing);
				int skillValue4 = hero.GetSkillValue(DefaultSkills.Engineering);
				if (skillValue >= skillValue2 && skillValue >= skillValue3 && skillValue >= skillValue4)
				{
					return new ValueTuple<SkillObject, int>(DefaultSkills.Bow, 150);
				}
				if (skillValue2 >= skillValue3 && skillValue2 >= skillValue4)
				{
					return new ValueTuple<SkillObject, int>(DefaultSkills.Crossbow, 150);
				}
				if (skillValue3 < skillValue4)
				{
					return new ValueTuple<SkillObject, int>(DefaultSkills.Engineering, 120);
				}
				return new ValueTuple<SkillObject, int>(DefaultSkills.Throwing, 150);
			}

			// Token: 0x04001950 RID: 6480
			internal const int IssuePreConditionMaxSecurityLevel = 50;

			// Token: 0x04001951 RID: 6481
			internal const int IssueStayAliveConditionMaxSecurityLevel = 80;

			// Token: 0x04001952 RID: 6482
			internal const float IssuePreConditionMinPlayerRelation = -10f;

			// Token: 0x04001953 RID: 6483
			internal const int MinimumRequiredMenCount = 20;

			// Token: 0x04001954 RID: 6484
			internal const int IssueDuration = 15;

			// Token: 0x04001955 RID: 6485
			internal const int QuestTimeLimit = 12;

			// Token: 0x04001956 RID: 6486
			internal const int AlternativeSolutionTroopTierRequirement = 2;

			// Token: 0x04001957 RID: 6487
			private const int AlternativeSolutionRangedSkillThreshold = 150;

			// Token: 0x04001958 RID: 6488
			private const int AlternativeSolutionEngineeringSkillThreshold = 120;

			// Token: 0x04001959 RID: 6489
			private const int AlternativeSolutionHonorRewardOnSuccess = 60;

			// Token: 0x0400195A RID: 6490
			private const int AlternativeSolutionHonorPenaltyOnFail = -20;

			// Token: 0x0400195B RID: 6491
			private const int AlternativeSolutionRelationRewardOnSuccess = 8;

			// Token: 0x0400195C RID: 6492
			private const int AlternativeSolutionRelationPenaltyOnFail = -10;

			// Token: 0x0400195D RID: 6493
			private const int AlternativeSolutionIssueOwnerPowerBonusOnSuccess = 15;

			// Token: 0x0400195E RID: 6494
			private const int AlternativeSolutionIssueOwnerPowerPenaltyOnFail = -10;

			// Token: 0x0400195F RID: 6495
			private const int AlternativeSolutionTownSecurityBonusOnSuccess = 10;

			// Token: 0x04001960 RID: 6496
			private const int AlternativeSolutionTownSecurityPenaltyOnFail = -10;

			// Token: 0x04001961 RID: 6497
			private const int AlternativeSolutionTownProsperityBonusOnSuccess = 100;

			// Token: 0x04001962 RID: 6498
			private const int AlternativeSolutionTownProsperityPenaltyOnFail = -50;

			// Token: 0x04001963 RID: 6499
			private const int AlternativeSolutionPlayerRenownBonusOnSuccess = 2;
		}

		// Token: 0x0200061A RID: 1562
		public class ExtortionByDesertersIssueQuest : QuestBase
		{
			// Token: 0x06004AAE RID: 19118 RVA: 0x00158959 File Offset: 0x00156B59
			internal static void AutoGeneratedStaticCollectObjectsExtortionByDesertersIssueQuest(object o, List<object> collectedObjects)
			{
				((ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
			}

			// Token: 0x06004AAF RID: 19119 RVA: 0x00158967 File Offset: 0x00156B67
			protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
			{
				base.AutoGeneratedInstanceCollectObjects(collectedObjects);
				collectedObjects.Add(this._deserterMobileParty);
				collectedObjects.Add(this._defenderMobileParty);
			}

			// Token: 0x06004AB0 RID: 19120 RVA: 0x00158988 File Offset: 0x00156B88
			internal static object AutoGeneratedGetMemberValue_deserterMobileParty(object o)
			{
				return ((ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest)o)._deserterMobileParty;
			}

			// Token: 0x06004AB1 RID: 19121 RVA: 0x00158995 File Offset: 0x00156B95
			internal static object AutoGeneratedGetMemberValue_defenderMobileParty(object o)
			{
				return ((ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest)o)._defenderMobileParty;
			}

			// Token: 0x06004AB2 RID: 19122 RVA: 0x001589A2 File Offset: 0x00156BA2
			internal static object AutoGeneratedGetMemberValue_currentState(object o)
			{
				return ((ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest)o)._currentState;
			}

			// Token: 0x06004AB3 RID: 19123 RVA: 0x001589B4 File Offset: 0x00156BB4
			internal static object AutoGeneratedGetMemberValue_questDifficultyMultiplier(object o)
			{
				return ((ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest)o)._questDifficultyMultiplier;
			}

			// Token: 0x06004AB4 RID: 19124 RVA: 0x001589C6 File Offset: 0x00156BC6
			internal static object AutoGeneratedGetMemberValue_deserterBattleFinalizedForTheFirstTime(object o)
			{
				return ((ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest)o)._deserterBattleFinalizedForTheFirstTime;
			}

			// Token: 0x17000EF6 RID: 3830
			// (get) Token: 0x06004AB5 RID: 19125 RVA: 0x001589D8 File Offset: 0x00156BD8
			public override TextObject Title
			{
				get
				{
					TextObject textObject = new TextObject("{=vbiA31xT}Extortion by Deserters at {SETTLEMENT}", null);
					textObject.SetTextVariable("SETTLEMENT", this.QuestSettlement.Name);
					return textObject;
				}
			}

			// Token: 0x17000EF7 RID: 3831
			// (get) Token: 0x06004AB6 RID: 19126 RVA: 0x001589FC File Offset: 0x00156BFC
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult _questResultSuccess1
			{
				get
				{
					return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult(0, 20, 1f, 4, 5, 10, 0, true);
				}
			}

			// Token: 0x17000EF8 RID: 3832
			// (get) Token: 0x06004AB7 RID: 19127 RVA: 0x00158A11 File Offset: 0x00156C11
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult _questResultSuccess2
			{
				get
				{
					return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult(1, 40, 0.5f, 6, 10, 10, 25, true);
				}
			}

			// Token: 0x17000EF9 RID: 3833
			// (get) Token: 0x06004AB8 RID: 19128 RVA: 0x00158A28 File Offset: 0x00156C28
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult _questResultSuccess3
			{
				get
				{
					return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult(2, 60, 0f, 8, 15, 10, 100, true);
				}
			}

			// Token: 0x17000EFA RID: 3834
			// (get) Token: 0x06004AB9 RID: 19129 RVA: 0x00158A3F File Offset: 0x00156C3F
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult _questResultFail1
			{
				get
				{
					return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult(0, -20, 0f, -10, -10, -10, -50, false);
				}
			}

			// Token: 0x17000EFB RID: 3835
			// (get) Token: 0x06004ABA RID: 19130 RVA: 0x00158A57 File Offset: 0x00156C57
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult _questResultFail2
			{
				get
				{
					return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult(0, -20, 0f, -10, -10, -10, -50, false);
				}
			}

			// Token: 0x17000EFC RID: 3836
			// (get) Token: 0x06004ABB RID: 19131 RVA: 0x00158A6F File Offset: 0x00156C6F
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult _questResultFail3
			{
				get
				{
					return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult(0, -50, 0f, -5, -10, -10, -50, false);
				}
			}

			// Token: 0x17000EFD RID: 3837
			// (get) Token: 0x06004ABC RID: 19132 RVA: 0x00158A87 File Offset: 0x00156C87
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult _questResultTimeOut
			{
				get
				{
					return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult(0, -20, 0f, -10, 0, 0, 0, false);
				}
			}

			// Token: 0x17000EFE RID: 3838
			// (get) Token: 0x06004ABD RID: 19133 RVA: 0x00158A9C File Offset: 0x00156C9C
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult _questResultCancel1
			{
				get
				{
					return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult(0, 0, 0f, 0, 0, 0, 0, false);
				}
			}

			// Token: 0x17000EFF RID: 3839
			// (get) Token: 0x06004ABE RID: 19134 RVA: 0x00158AAF File Offset: 0x00156CAF
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult _questResultCancel2
			{
				get
				{
					return new ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult(0, 0, 0f, 0, 0, 0, 0, false);
				}
			}

			// Token: 0x17000F00 RID: 3840
			// (get) Token: 0x06004ABF RID: 19135 RVA: 0x00158AC4 File Offset: 0x00156CC4
			private TextObject _onQuestStartedLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=pWxXvtXP}{QUEST_GIVER.LINK}, a headman of {QUEST_SETTLEMENT} told you that a group of deserters have been raiding their village regularly. {?QUEST_GIVER.GENDER}She{?}He{\\?} asked you to wait in {QUEST_SETTLEMENT} until the deserters arrive...", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("QUEST_SETTLEMENT", this.QuestSettlement.EncyclopediaLinkWithName);
					return textObject;
				}
			}

			// Token: 0x17000F01 RID: 3841
			// (get) Token: 0x06004AC0 RID: 19136 RVA: 0x00158B0D File Offset: 0x00156D0D
			private TextObject _onQuestSucceededLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=IXkgPlKR}You have defeated the deserters and saved the people of {QUEST_SETTLEMENT}.", null);
					textObject.SetTextVariable("QUEST_SETTLEMENT", this.QuestSettlement.Name);
					return textObject;
				}
			}

			// Token: 0x17000F02 RID: 3842
			// (get) Token: 0x06004AC1 RID: 19137 RVA: 0x00158B31 File Offset: 0x00156D31
			private TextObject _onQuestFailed1LogText
			{
				get
				{
					return new TextObject("{=bdWc1VEl}You've lost track of the deserter party.", null);
				}
			}

			// Token: 0x17000F03 RID: 3843
			// (get) Token: 0x06004AC2 RID: 19138 RVA: 0x00158B3E File Offset: 0x00156D3E
			private TextObject _onQuestFailed2LogText
			{
				get
				{
					return new TextObject("{=oYJCP3mt}You've failed to stop the deserters. The deserters ravaged the village and left.", null);
				}
			}

			// Token: 0x17000F04 RID: 3844
			// (get) Token: 0x06004AC3 RID: 19139 RVA: 0x00158B4C File Offset: 0x00156D4C
			private TextObject _onQuestFailed3LogText
			{
				get
				{
					TextObject textObject = new TextObject("{=GLuN0dZg}Your criminal action towards {QUEST_SETTLEMENT} has angered {QUEST_GIVER.LINK} and {?QUEST_GIVER.GENDER}she{?}he{\\?} broke off the agreement that you had.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					textObject.SetTextVariable("QUEST_SETTLEMENT", this.QuestSettlement.EncyclopediaLinkWithName);
					return textObject;
				}
			}

			// Token: 0x17000F05 RID: 3845
			// (get) Token: 0x06004AC4 RID: 19140 RVA: 0x00158B98 File Offset: 0x00156D98
			private TextObject _onQuestTimedOutLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=YjxCkglX}You've failed to complete this quest in time. Your agreement with {QUEST_GIVER.LINK} was canceled.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000F06 RID: 3846
			// (get) Token: 0x06004AC5 RID: 19141 RVA: 0x00158BCC File Offset: 0x00156DCC
			private TextObject _onQuestCancel1LogText
			{
				get
				{
					TextObject textObject = new TextObject("{=x346Rqle}Your clan is now at war with the {QUEST_GIVER.LINK}'s lord. Your agreement was canceled.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000F07 RID: 3847
			// (get) Token: 0x06004AC6 RID: 19142 RVA: 0x00158C00 File Offset: 0x00156E00
			private TextObject _playerDeclaredWarQuestLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=bqeWVVEE}Your actions have started a war with {QUEST_GIVER.LINK}'s faction. {?QUEST_GIVER.GENDER}She{?}He{\\?} cancels your agreement and the quest is a failure.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000F08 RID: 3848
			// (get) Token: 0x06004AC7 RID: 19143 RVA: 0x00158C34 File Offset: 0x00156E34
			private TextObject _onQuestCancel2LogText
			{
				get
				{
					TextObject textObject = new TextObject("{=wTx2MNIJ}{QUEST_SETTLEMENT} was raided. {QUEST_GIVER.LINK} can no longer fulfill your contract. Agreement was canceled.", null);
					textObject.SetTextVariable("QUEST_SETTLEMENT", this.QuestSettlement.Name);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000F09 RID: 3849
			// (get) Token: 0x06004AC8 RID: 19144 RVA: 0x00158C80 File Offset: 0x00156E80
			private TextObject _onDeserterPartyDefeatedLogText
			{
				get
				{
					TextObject textObject = new TextObject("{=sRBvUj6U}The deserter party is defeated. Return back to {QUEST_GIVER.LINK} to claim your rewards.", null);
					StringHelpers.SetCharacterProperties("QUEST_GIVER", base.QuestGiver.CharacterObject, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000F0A RID: 3850
			// (get) Token: 0x06004AC9 RID: 19145 RVA: 0x00158CB4 File Offset: 0x00156EB4
			private TextObject _onPlayerLeftQuestSettlementNotificationText
			{
				get
				{
					TextObject textObject = new TextObject("{=qjuiWN4K}{PLAYER.NAME}, you should wait with us in the village to ambush the deserters!", null);
					StringHelpers.SetCharacterProperties("PLAYER", CharacterObject.PlayerCharacter, textObject, false);
					return textObject;
				}
			}

			// Token: 0x17000F0B RID: 3851
			// (get) Token: 0x06004ACA RID: 19146 RVA: 0x00158CE0 File Offset: 0x00156EE0
			private TextObject _onPlayerDefeatedDesertersNotificationText
			{
				get
				{
					TextObject textObject = new TextObject("{=EfZaCzb0}{PLAYER.NAME}, please return back to {QUEST_SETTLEMENT} to claim your rewards.", null);
					StringHelpers.SetCharacterProperties("PLAYER", CharacterObject.PlayerCharacter, textObject, false);
					textObject.SetTextVariable("QUEST_SETTLEMENT", this.QuestSettlement.Name);
					return textObject;
				}
			}

			// Token: 0x17000F0C RID: 3852
			// (get) Token: 0x06004ACB RID: 19147 RVA: 0x00158D23 File Offset: 0x00156F23
			private TextObject _onDesertersNoticedPlayerNotificationText
			{
				get
				{
					return new TextObject("{=9vzm2j5T}Deserters have noticed our presence, they are running away!", null);
				}
			}

			// Token: 0x17000F0D RID: 3853
			// (get) Token: 0x06004ACC RID: 19148 RVA: 0x00158D30 File Offset: 0x00156F30
			private DialogFlow QuestCompletionDialogFlow
			{
				get
				{
					return DialogFlow.CreateDialogFlow("start", 125).NpcLine("{=SCaWkKF1}Here is what we've promised, {GOLD_REWARD}{GOLD_ICON} denars. I hope this makes it worth the blood spilled.[if:convo_normal][ib:hip]", null, null).Condition(delegate
					{
						MBTextManager.SetTextVariable("GOLD_REWARD", this.RewardGold);
						return Hero.OneToOneConversationHero == base.QuestGiver && this._currentState == ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersAreDefeated;
					}).BeginPlayerOptions().PlayerOption("{=Bb3oHQNa}Thanks, this will come in handy.", null).NpcLine("{=khIuyBAi}Thank you for your help. Farewell.", null, null).Consequence(delegate
					{
						ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult questResultSuccess = this._questResultSuccess1;
						this.ApplyQuestResult(questResultSuccess);
						base.AddLog(this._onQuestSucceededLogText, false);
						base.CompleteQuestWithSuccess();
					}).CloseDialog().PlayerOption("{=xcyr5Oq2}Half of the coin is enough for our needs.", null).NpcLine("{=SVrCpvpZ}Thank you {PLAYER.NAME}. Our people are grateful to you for what you have done today. Farewell.[if:convo_relaxed_happy]", null, null).Condition(() => true).Consequence(delegate
					{
						ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult questResultSuccess = this._questResultSuccess2;
						this.ApplyQuestResult(questResultSuccess);
						base.AddLog(this._onQuestSucceededLogText, false);
						base.CompleteQuestWithSuccess();
					}).CloseDialog().PlayerOption("{=52GFRUTE}Keep your coin, headman. Your people's blessings are enough.", null).NpcLine("{=1l5dKk1c}Oh, thank you {PLAYER.NAME}. You will always be remembered by our people. Farewell.[if:convo_merry]", null, null).Condition(() => true).Consequence(delegate
					{
						ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult questResultSuccess = this._questResultSuccess3;
						this.ApplyQuestResult(questResultSuccess);
						base.AddLog(this._onQuestSucceededLogText, false);
						base.CompleteQuestWithSuccess();
					}).CloseDialog().EndPlayerOptions().CloseDialog();
				}
			}

			// Token: 0x17000F0E RID: 3854
			// (get) Token: 0x06004ACD RID: 19149 RVA: 0x00158E44 File Offset: 0x00157044
			private DialogFlow DeserterPartyAmbushedDialogFlow
			{
				get
				{
					return DialogFlow.CreateDialogFlow("start", 125).NpcLine("{=s2btPjJf}Who the hell are you? If you live in this village, you'd better rustle up some silver and wine. Look lively, eh?[if:convo_confused_annoyed][ib:warrior]", null, null).Condition(() => this._deserterMobileParty != null && this._deserterMobileParty.IsActive && CharacterObject.OneToOneConversationCharacter == ConversationHelper.GetConversationCharacterPartyLeader(this._deserterMobileParty.Party) && this._deserterMobileParty.Position2D.Distance(this.QuestSettlement.Position2D) <= 5f).PlayerLine("{=Pp3koSqA}This time you'll have to fight for it!", null).CloseDialog();
				}
			}

			// Token: 0x17000F0F RID: 3855
			// (get) Token: 0x06004ACE RID: 19150 RVA: 0x00158E7F File Offset: 0x0015707F
			private int DeserterPartyMenCount
			{
				get
				{
					return 24 + MathF.Ceiling(24f * this._questDifficultyMultiplier);
				}
			}

			// Token: 0x17000F10 RID: 3856
			// (get) Token: 0x06004ACF RID: 19151 RVA: 0x00158E95 File Offset: 0x00157095
			private int DefenderPartyMenCount
			{
				get
				{
					return 16 + MathF.Ceiling(16f * this._questDifficultyMultiplier);
				}
			}

			// Token: 0x17000F11 RID: 3857
			// (get) Token: 0x06004AD0 RID: 19152 RVA: 0x00158EAB File Offset: 0x001570AB
			public Settlement QuestSettlement
			{
				get
				{
					return base.QuestGiver.CurrentSettlement;
				}
			}

			// Token: 0x17000F12 RID: 3858
			// (get) Token: 0x06004AD1 RID: 19153 RVA: 0x00158EB8 File Offset: 0x001570B8
			public override bool IsRemainingTimeHidden
			{
				get
				{
					return false;
				}
			}

			// Token: 0x06004AD2 RID: 19154 RVA: 0x00158EBC File Offset: 0x001570BC
			public ExtortionByDesertersIssueQuest(string questId, Hero questGiver, float difficultyMultiplier, int rewardGold, CampaignTime duration) : base(questId, questGiver, duration, rewardGold)
			{
				StringHelpers.SetCharacterProperties("PLAYER", CharacterObject.PlayerCharacter, null, false);
				this._questDifficultyMultiplier = difficultyMultiplier;
				this._defenderMobileParty = null;
				this._deserterBattleFinalizedForTheFirstTime = false;
				this._playerAwayFromSettlementNotificationSent = false;
				this.CreateDeserterParty();
				this._currentState = ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersMovingToSettlement;
				base.AddTrackedObject(this._deserterMobileParty);
				this.SetDialogs();
				base.InitializeQuestOnCreation();
			}

			// Token: 0x06004AD3 RID: 19155 RVA: 0x00158F28 File Offset: 0x00157128
			protected override void InitializeQuestOnGameLoad()
			{
				StringHelpers.SetCharacterProperties("PLAYER", CharacterObject.PlayerCharacter, null, false);
				this._playerAwayFromSettlementNotificationSent = false;
				if (this._currentState == ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersMovingToSettlement)
				{
					float num = this._deserterMobileParty.Position2D.Distance(MobileParty.MainParty.Position2D);
					bool flag = PlayerEncounter.Current != null && PlayerEncounter.EncounterSettlement == this.QuestSettlement;
					bool flag2 = num <= this._deserterMobileParty.SeeingRange * 0.8f;
					this._playerAwayFromSettlementNotificationSent = (!flag && !flag2);
				}
				this.SetDialogs();
				Campaign.Current.ConversationManager.AddDialogFlow(this.QuestCompletionDialogFlow, this);
				Campaign.Current.ConversationManager.AddDialogFlow(this.DeserterPartyAmbushedDialogFlow, this);
			}

			// Token: 0x06004AD4 RID: 19156 RVA: 0x00158FE4 File Offset: 0x001571E4
			protected override void SetDialogs()
			{
				this.OfferDialogFlow = DialogFlow.CreateDialogFlow("issue_classic_quest_start", 100).NpcLine("{=PnRVabwv}Thank you. Just wait in the village. We'll stand lookout and lure them into your ambush. Just wait for the signal.", null, null).Condition(() => Hero.OneToOneConversationHero == base.QuestGiver).Consequence(new ConversationSentence.OnConsequenceDelegate(this.OnQuestAccepted)).CloseDialog();
				this.DiscussDialogFlow = DialogFlow.CreateDialogFlow("quest_discuss", 100).NpcLine("{=iN1kBsac}I don't think they'll be long now. Our hunters have spotted them making ready. Keep waiting.", null, null).Condition(() => Hero.OneToOneConversationHero == base.QuestGiver).BeginPlayerOptions().PlayerOption("{=IJihRdfF}Don't worry, we'll be ready for the fight.", null).NpcLine("{=U0UoayfA}Good, good. Thank you again.", null, null).CloseDialog().PlayerOption("{=bcGzpFSg}Are you sure about what your hunters saw? My men are starting to run out of patience.", null).NpcLine("{=YsASaPKq}I'm sure they'll be here soon. Please don't leave the village, or we'll stand no chance...[if:convo_nervous][ib:nervous]", null, null).CloseDialog().EndPlayerOptions().CloseDialog();
				this.QuestCharacterDialogFlow = DialogFlow.CreateDialogFlow("start", 125).NpcLine("{=rAqyKcKZ}Who the hell are you? What do you want from us?[if:convo_confused_annoyed][ib:aggressive]", null, null).Condition(() => this._deserterMobileParty != null && this._deserterMobileParty.IsActive && CharacterObject.OneToOneConversationCharacter == ConversationHelper.GetConversationCharacterPartyLeader(this._deserterMobileParty.Party) && this._deserterMobileParty.Position2D.Distance(this.QuestSettlement.Position2D) >= 5f).BeginPlayerOptions().PlayerOption("{=Ljs9ahMk}I know your intentions. I will not let you steal from those poor villagers!", null).CloseDialog().EndPlayerOptions().CloseDialog();
			}

			// Token: 0x06004AD5 RID: 19157 RVA: 0x001590FC File Offset: 0x001572FC
			private void OnQuestAccepted()
			{
				base.StartQuest();
				Campaign.Current.ConversationManager.AddDialogFlow(this.QuestCompletionDialogFlow, this);
				Campaign.Current.ConversationManager.AddDialogFlow(this.DeserterPartyAmbushedDialogFlow, this);
				base.AddLog(this._onQuestStartedLogText, false);
			}

			// Token: 0x06004AD6 RID: 19158 RVA: 0x0015914C File Offset: 0x0015734C
			private void ApplyQuestResult(in ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult result)
			{
				int num = (int)(result.GoldMultiplier * (float)this.RewardGold);
				if (num > 0)
				{
					GiveGoldAction.ApplyBetweenCharacters(null, Hero.MainHero, num, false);
				}
				if (result.QuestGiverPowerChange != 0)
				{
					base.QuestGiver.AddPower((float)result.QuestGiverPowerChange);
				}
				if (result.TownSecurityChange != 0)
				{
					this.QuestSettlement.Village.Bound.Town.Security += (float)result.TownSecurityChange;
				}
				if (result.TownProsperityChange != 0)
				{
					this.QuestSettlement.Village.Bound.Town.Prosperity += (float)result.TownProsperityChange;
				}
				if (result.HonorChange != 0)
				{
					if (result.IsSuccess)
					{
						TraitLevelingHelper.OnIssueSolvedThroughQuest(base.QuestGiver, new Tuple<TraitObject, int>[]
						{
							new Tuple<TraitObject, int>(DefaultTraits.Honor, result.HonorChange)
						});
					}
					else
					{
						TraitLevelingHelper.OnIssueFailed(base.QuestGiver, new Tuple<TraitObject, int>[]
						{
							new Tuple<TraitObject, int>(DefaultTraits.Honor, result.HonorChange)
						});
					}
				}
				if (result.QuestGiverRelationChange != 0)
				{
					this.RelationshipChangeWithQuestGiver = result.QuestGiverRelationChange;
				}
				if (result.RenownChange > 0)
				{
					GainRenownAction.Apply(Hero.MainHero, (float)result.RenownChange, false);
				}
			}

			// Token: 0x06004AD7 RID: 19159 RVA: 0x00159280 File Offset: 0x00157480
			protected override void RegisterEvents()
			{
				CampaignEvents.MapEventEnded.AddNonSerializedListener(this, new Action<MapEvent>(this.MapEventEnded));
				CampaignEvents.GameMenuOpened.AddNonSerializedListener(this, new Action<MenuCallbackArgs>(this.GameMenuOpened));
				CampaignEvents.WarDeclared.AddNonSerializedListener(this, new Action<IFaction, IFaction, DeclareWarAction.DeclareWarDetail>(this.OnWarDeclared));
				CampaignEvents.OnClanChangedKingdomEvent.AddNonSerializedListener(this, new Action<Clan, Kingdom, Kingdom, ChangeKingdomAction.ChangeKingdomActionDetail, bool>(this.OnClanChangedKingdom));
				CampaignEvents.SettlementEntered.AddNonSerializedListener(this, new Action<MobileParty, Settlement, Hero>(this.SettlementEntered));
				CampaignEvents.GameMenuOptionSelectedEvent.AddNonSerializedListener(this, new Action<GameMenuOption>(this.GameMenuOptionSelected));
				CampaignEvents.VillageBeingRaided.AddNonSerializedListener(this, new Action<Village>(this.OnVillageBeingRaided));
				CampaignEvents.MapEventStarted.AddNonSerializedListener(this, new Action<MapEvent, PartyBase, PartyBase>(this.OnMapEventStarted));
			}

			// Token: 0x06004AD8 RID: 19160 RVA: 0x00159348 File Offset: 0x00157548
			private void OnMapEventStarted(MapEvent mapEvent, PartyBase attackerParty, PartyBase defenderParty)
			{
				if (attackerParty == PartyBase.MainParty)
				{
					if (mapEvent.IsFieldBattle && defenderParty.IsMobile && defenderParty.MobileParty.HomeSettlement == this.QuestSettlement)
					{
						base.CompleteQuestWithFail(this._onQuestFailed3LogText);
						ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult questResultFail = this._questResultFail3;
						this.ApplyQuestResult(questResultFail);
						return;
					}
					if (QuestHelper.CheckMinorMajorCoercion(this, mapEvent, attackerParty))
					{
						QuestHelper.ApplyGenericMinorMajorCoercionConsequences(this, mapEvent);
					}
				}
			}

			// Token: 0x06004AD9 RID: 19161 RVA: 0x001593AD File Offset: 0x001575AD
			protected override void OnFinalize()
			{
				this.DestroyDefenderParty();
				this.ReleaseDeserterParty();
			}

			// Token: 0x06004ADA RID: 19162 RVA: 0x001593BC File Offset: 0x001575BC
			private void TickDesertersPartyLogic()
			{
				if ((this._deserterMobileParty == null || this._deserterMobileParty.MapEvent == null) && base.IsOngoing)
				{
					switch (this._currentState)
					{
					case ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersMovingToSettlement:
					{
						float num = this._deserterMobileParty.Position2D.Distance(MobileParty.MainParty.Position2D);
						bool flag = PlayerEncounter.Current != null && PlayerEncounter.EncounterSettlement == this.QuestSettlement;
						bool flag2 = num <= this._deserterMobileParty.SeeingRange * 0.8f;
						if (!flag)
						{
							if (flag2)
							{
								MBInformationManager.AddQuickInformation(this._onDesertersNoticedPlayerNotificationText, 0, Hero.MainHero.CharacterObject, "");
								this.HandleDesertersRunningAway();
								this._currentState = ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersRunningAwayFromPlayer;
								return;
							}
							if (!this._playerAwayFromSettlementNotificationSent)
							{
								MBInformationManager.AddQuickInformation(this._onPlayerLeftQuestSettlementNotificationText, 0, base.QuestGiver.CharacterObject, "");
								this._playerAwayFromSettlementNotificationSent = true;
								return;
							}
						}
						else if (!this._deserterMobileParty.IsCurrentlyGoingToSettlement)
						{
							SetPartyAiAction.GetActionForVisitingSettlement(this._deserterMobileParty, this.QuestSettlement);
							return;
						}
						break;
					}
					case ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersRunningAwayFromPlayer:
						if (this._deserterMobileParty.Position2D.Distance(MobileParty.MainParty.Position2D) > MobileParty.MainParty.SeeingRange + 3f)
						{
							ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult questResultFail = this._questResultFail1;
							this.ApplyQuestResult(questResultFail);
							base.CompleteQuestWithFail(this._onQuestFailed1LogText);
							return;
						}
						this.HandleDesertersRunningAway();
						return;
					case ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersDefeatedPlayer:
						if (!this._deserterMobileParty.IsCurrentlyGoingToSettlement)
						{
							SetPartyAiAction.GetActionForVisitingSettlement(this._deserterMobileParty, this.QuestSettlement);
						}
						break;
					default:
						return;
					}
				}
			}

			// Token: 0x06004ADB RID: 19163 RVA: 0x00159549 File Offset: 0x00157749
			protected override void HourlyTick()
			{
				this.TickDesertersPartyLogic();
			}

			// Token: 0x06004ADC RID: 19164 RVA: 0x00159554 File Offset: 0x00157754
			private void MapEventEnded(MapEvent mapEvent)
			{
				if (mapEvent.IsPlayerMapEvent && this._deserterMobileParty != null && mapEvent.InvolvedParties.Contains(this._deserterMobileParty.Party))
				{
					this._deserterBattleFinalizedForTheFirstTime = true;
					if (mapEvent.WinningSide == mapEvent.PlayerSide)
					{
						base.AddLog(this._onDeserterPartyDefeatedLogText, false);
						if (!base.IsTracked(base.QuestGiver))
						{
							base.AddTrackedObject(base.QuestGiver);
						}
						if (!base.IsTracked(this.QuestSettlement))
						{
							base.AddTrackedObject(this.QuestSettlement);
						}
						MBInformationManager.AddQuickInformation(this._onPlayerDefeatedDesertersNotificationText, 0, base.QuestGiver.CharacterObject, "");
						this._currentState = ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersAreDefeated;
						return;
					}
					if (!this._deserterMobileParty.IsCurrentlyGoingToSettlement)
					{
						SetPartyAiAction.GetActionForVisitingSettlement(this._deserterMobileParty, this.QuestSettlement);
					}
					this._currentState = ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersDefeatedPlayer;
				}
			}

			// Token: 0x06004ADD RID: 19165 RVA: 0x00159634 File Offset: 0x00157834
			private void GameMenuOpened(MenuCallbackArgs mArgs)
			{
				if (mArgs.MenuContext.GameMenu.StringId == "encounter" && this._deserterBattleFinalizedForTheFirstTime)
				{
					this._deserterBattleFinalizedForTheFirstTime = false;
					if (this._currentState == ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersAreDefeated)
					{
						this.DestroyDeserterParty();
					}
					this.DestroyDefenderParty();
				}
			}

			// Token: 0x06004ADE RID: 19166 RVA: 0x00159684 File Offset: 0x00157884
			private void OnClanChangedKingdom(Clan clan, Kingdom oldKingdom, Kingdom newKingdom, ChangeKingdomAction.ChangeKingdomActionDetail detail, bool showNotification = true)
			{
				if (base.QuestGiver.CurrentSettlement.MapFaction.IsAtWarWith(Hero.MainHero.MapFaction))
				{
					base.CompleteQuestWithCancel(this._onQuestCancel1LogText);
					ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult questResultCancel = this._questResultCancel1;
					this.ApplyQuestResult(questResultCancel);
				}
			}

			// Token: 0x06004ADF RID: 19167 RVA: 0x001596CD File Offset: 0x001578CD
			private void OnWarDeclared(IFaction faction1, IFaction faction2, DeclareWarAction.DeclareWarDetail detail)
			{
				QuestHelper.CheckWarDeclarationAndFailOrCancelTheQuest(this, faction1, faction2, detail, this._playerDeclaredWarQuestLogText, this._onQuestCancel1LogText, false);
			}

			// Token: 0x06004AE0 RID: 19168 RVA: 0x001596E8 File Offset: 0x001578E8
			private void OnVillageBeingRaided(Village village)
			{
				if (village.Settlement == this.QuestSettlement)
				{
					ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult extortionByDesertersQuestResult;
					if (village.Settlement.Party.MapEvent.AttackerSide.LeaderParty == PartyBase.MainParty)
					{
						extortionByDesertersQuestResult = this._questResultFail3;
						this.ApplyQuestResult(extortionByDesertersQuestResult);
						base.CompleteQuestWithFail(this._onQuestFailed3LogText);
						return;
					}
					extortionByDesertersQuestResult = this._questResultCancel2;
					this.ApplyQuestResult(extortionByDesertersQuestResult);
					base.CompleteQuestWithCancel(this._onQuestCancel2LogText);
				}
			}

			// Token: 0x06004AE1 RID: 19169 RVA: 0x0015975C File Offset: 0x0015795C
			private void SettlementEntered(MobileParty party, Settlement settlement, Hero hero)
			{
				if (party == this._deserterMobileParty && settlement == this.QuestSettlement)
				{
					bool flag = PlayerEncounter.Current != null && PlayerEncounter.EncounterSettlement == this.QuestSettlement;
					if (this._currentState != ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState.DesertersDefeatedPlayer && flag)
					{
						this.StartAmbushEncounter();
						return;
					}
					ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult questResultFail = this._questResultFail2;
					this.ApplyQuestResult(questResultFail);
					base.CompleteQuestWithFail(this._onQuestFailed2LogText);
				}
			}

			// Token: 0x06004AE2 RID: 19170 RVA: 0x001597C5 File Offset: 0x001579C5
			private void GameMenuOptionSelected(GameMenuOption option)
			{
				if (option.IsLeave)
				{
					this.TickDesertersPartyLogic();
				}
			}

			// Token: 0x06004AE3 RID: 19171 RVA: 0x001597D8 File Offset: 0x001579D8
			protected override void OnTimedOut()
			{
				ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestResult questResultTimeOut = this._questResultTimeOut;
				this.ApplyQuestResult(questResultTimeOut);
				base.AddLog(this._onQuestTimedOutLogText, false);
			}

			// Token: 0x06004AE4 RID: 19172 RVA: 0x00159804 File Offset: 0x00157A04
			private void CreateDeserterParty()
			{
				Settlement settlement = SettlementHelper.FindNearestHideout(null, null);
				Clan clan = null;
				if (settlement != null)
				{
					CultureObject banditCulture = settlement.Culture;
					clan = Clan.BanditFactions.FirstOrDefault((Clan x) => x.Culture == banditCulture);
				}
				if (clan == null)
				{
					clan = Clan.All.GetRandomElementWithPredicate((Clan x) => x.IsBanditFaction);
				}
				PartyTemplateObject defaultPartyTemplate = this.QuestSettlement.Culture.DefaultPartyTemplate;
				this._deserterMobileParty = BanditPartyComponent.CreateBanditParty("ebdi_deserters_party_1", clan, settlement.Hideout, false);
				TextObject customName = new TextObject("{=zT2b0v8y}Deserters Party", null);
				Vec2 position = this.FindBestSpawnPositionForDeserterParty();
				this._deserterMobileParty.InitializeMobilePartyAtPosition(defaultPartyTemplate, position, this.DeserterPartyMenCount);
				this._deserterMobileParty.SetCustomName(customName);
				int num = 0;
				foreach (TroopRosterElement troopRosterElement in this._deserterMobileParty.MemberRoster.GetTroopRoster())
				{
					if (!troopRosterElement.Character.HasMount())
					{
						num += troopRosterElement.Number;
					}
				}
				ItemObject itemObject = Items.All.GetRandomElementWithPredicate((ItemObject x) => x.IsMountable && x.Culture == this.QuestSettlement.Culture && !x.NotMerchandise && x.Tier == ItemObject.ItemTiers.Tier2);
				if (itemObject == null)
				{
					itemObject = (MBObjectManager.Instance.GetObject<ItemObject>("vlandia_horse") ?? MBObjectManager.Instance.GetObject<ItemObject>("sumpter_horse"));
				}
				if (itemObject != null)
				{
					this._deserterMobileParty.ItemRoster.AddToCounts(itemObject, num);
				}
				float num2 = MathF.Abs(this._deserterMobileParty.FoodChange);
				int num3 = MathF.Ceiling(base.QuestDueTime.RemainingDaysFromNow * num2);
				int num4 = num3 / 2;
				this._deserterMobileParty.ItemRoster.AddToCounts(DefaultItems.Grain, num4);
				int number = num3 - num4;
				this._deserterMobileParty.ItemRoster.AddToCounts(DefaultItems.Meat, number);
				this._deserterMobileParty.SetPartyUsedByQuest(true);
				this._deserterMobileParty.IgnoreByOtherPartiesTill(CampaignTime.Never);
				this._deserterMobileParty.Aggressiveness = 0f;
				this._deserterMobileParty.Ai.SetDoNotMakeNewDecisions(true);
				this._deserterMobileParty.Party.SetVisualAsDirty();
				SetPartyAiAction.GetActionForVisitingSettlement(this._deserterMobileParty, this.QuestSettlement);
			}

			// Token: 0x06004AE5 RID: 19173 RVA: 0x00159A5C File Offset: 0x00157C5C
			private Vec2 FindBestSpawnPositionForDeserterParty()
			{
				MobileParty mainParty = MobileParty.MainParty;
				Vec2 getPosition2D = mainParty.GetPosition2D;
				float seeingRange = mainParty.SeeingRange;
				float num = seeingRange + 3f;
				float num2 = num * 1.25f;
				float maximumDistance = num2 * 3f;
				Vec2 result = getPosition2D;
				float num3 = float.MaxValue;
				int num4 = 0;
				MapDistanceModel mapDistanceModel = Campaign.Current.Models.MapDistanceModel;
				do
				{
					Vec2 vec = MobilePartyHelper.FindReachablePointAroundPosition(getPosition2D, num, seeingRange);
					float num5;
					if (mapDistanceModel.GetDistance(mainParty, vec, maximumDistance, out num5))
					{
						if (num5 < num3)
						{
							result = vec;
							num3 = num5;
						}
						if (num5 < num2)
						{
							break;
						}
					}
					num4++;
				}
				while (num4 < 16);
				return result;
			}

			// Token: 0x06004AE6 RID: 19174 RVA: 0x00159AF2 File Offset: 0x00157CF2
			private void DestroyDeserterParty()
			{
				if (this._deserterMobileParty != null && this._deserterMobileParty.IsActive)
				{
					DestroyPartyAction.Apply(null, this._deserterMobileParty);
					this._deserterMobileParty = null;
				}
			}

			// Token: 0x06004AE7 RID: 19175 RVA: 0x00159B1C File Offset: 0x00157D1C
			private void ReleaseDeserterParty()
			{
				if (this._deserterMobileParty != null && this._deserterMobileParty.IsActive)
				{
					this._deserterMobileParty.SetPartyUsedByQuest(false);
					this._deserterMobileParty.IgnoreByOtherPartiesTill(CampaignTime.HoursFromNow(0f));
					this._deserterMobileParty.Aggressiveness = 1f;
					if (this._deserterMobileParty.CurrentSettlement != null)
					{
						LeaveSettlementAction.ApplyForParty(this._deserterMobileParty);
					}
					this._deserterMobileParty.Ai.SetDoNotMakeNewDecisions(false);
					this._deserterMobileParty.SetCustomName(null);
					this._deserterMobileParty.Party.SetVisualAsDirty();
				}
			}

			// Token: 0x06004AE8 RID: 19176 RVA: 0x00159BB8 File Offset: 0x00157DB8
			private void CreateDefenderParty()
			{
				PartyTemplateObject militiaPartyTemplate = this.QuestSettlement.Culture.MilitiaPartyTemplate;
				this._defenderMobileParty = MobileParty.CreateParty("ebdi_defender_party_1", null, null);
				TextObject textObject = new TextObject("{=dPU8UbKA}{QUEST_GIVER}'s Party", null);
				textObject.SetTextVariable("QUEST_GIVER", base.QuestGiver.Name);
				this._defenderMobileParty.InitializeMobilePartyAroundPosition(militiaPartyTemplate, this.QuestSettlement.GetPosition2D, 1f, 0.5f, this.DefenderPartyMenCount);
				this._defenderMobileParty.SetCustomName(textObject);
				this._defenderMobileParty.SetPartyUsedByQuest(true);
				this._defenderMobileParty.Party.SetCustomOwner(base.QuestGiver);
				this._defenderMobileParty.Aggressiveness = 1f;
				this._defenderMobileParty.ShouldJoinPlayerBattles = true;
				this._defenderMobileParty.ActualClan = base.QuestGiver.CurrentSettlement.OwnerClan;
			}

			// Token: 0x06004AE9 RID: 19177 RVA: 0x00159C97 File Offset: 0x00157E97
			private void DestroyDefenderParty()
			{
				if (this._defenderMobileParty != null && this._defenderMobileParty.IsActive)
				{
					DestroyPartyAction.Apply(null, this._defenderMobileParty);
					this._defenderMobileParty = null;
				}
			}

			// Token: 0x06004AEA RID: 19178 RVA: 0x00159CC4 File Offset: 0x00157EC4
			private void HandleDesertersRunningAway()
			{
				Vec2 v = this._deserterMobileParty.Position2D - MobileParty.MainParty.Position2D;
				v.Normalize();
				float f = this._deserterMobileParty.Speed * 1.5f;
				Vec2 vec = this._deserterMobileParty.Position2D + v * f;
				float num;
				vec = this.FindFreePositionBetweenPointAndParty(this._deserterMobileParty, vec, out num, 10f, 1E-05f, 1000f, 1.5f);
				PathFaceRecord faceIndex = Campaign.Current.MapSceneWrapper.GetFaceIndex(vec);
				float angleInRadians = 0.34906584f;
				int num2 = 0;
				while (num2 < 10 && (faceIndex.FaceIndex == -1 || faceIndex.FaceIslandIndex == -1))
				{
					v.RotateCCW(angleInRadians);
					v.Normalize();
					MobileParty deserterMobileParty = this._deserterMobileParty;
					Vec2 vec2 = this._deserterMobileParty.Position2D + v * f;
					float num3;
					vec = this.FindFreePositionBetweenPointAndParty(deserterMobileParty, vec2, out num3, 10f, 1E-05f, 1000f, 1.5f);
					faceIndex = Campaign.Current.MapSceneWrapper.GetFaceIndex(vec);
					num2++;
				}
				if (num <= 1E-05f)
				{
					v.RotateCCW(-1.5707964f + (float)MBRandom.RandomInt(0, 2) * 3.1415927f);
					vec = this._deserterMobileParty.Position2D + v * f;
					vec = this.FindFreePositionBetweenPointAndParty(this._deserterMobileParty, vec, out num, 10f, 1E-05f, 1000f, 1.5f);
				}
				this._deserterMobileParty.Ai.SetMoveGoToPoint(vec);
			}

			// Token: 0x06004AEB RID: 19179 RVA: 0x00159E58 File Offset: 0x00158058
			private void StartAmbushEncounter()
			{
				this.CreateDefenderParty();
				this._deserterMobileParty.IgnoreByOtherPartiesTill(CampaignTime.Now - CampaignTime.Hours(1f));
				EncounterManager.StartPartyEncounter(this._deserterMobileParty.Party, MobileParty.MainParty.Party);
			}

			// Token: 0x06004AEC RID: 19180 RVA: 0x00159EA4 File Offset: 0x001580A4
			private Vec2 FindFreePositionBetweenPointAndParty(MobileParty party, in Vec2 point, out float distance, float maxIterations = 10f, float acceptThres = 1E-05f, float maxPathDistance = 1000f, float euclideanThressholdFactor = 1.5f)
			{
				IMapScene mapSceneWrapper = Campaign.Current.MapSceneWrapper;
				Vec2 position2D = party.Position2D;
				PathFaceRecord faceIndex = mapSceneWrapper.GetFaceIndex(position2D);
				Vec2 vec = position2D;
				distance = 0f;
				if (!PartyBase.IsPositionOkForTraveling(position2D))
				{
					Debug.FailedAssert("Origin point not valid!", "C:\\Develop\\MB3\\Source\\Bannerlord\\TaleWorlds.CampaignSystem\\Issues\\ExtortionByDesertersIssueBehavior.cs", "FindFreePositionBetweenPointAndParty", 1368);
				}
				else
				{
					Vec2 vec2 = point;
					PathFaceRecord faceIndex2 = mapSceneWrapper.GetFaceIndex(vec2);
					Vec2 v = point;
					float num = acceptThres * acceptThres;
					int num2 = 0;
					while ((float)num2 < maxIterations && vec.DistanceSquared(point) > num && faceIndex2.IsValid())
					{
						float num3 = position2D.Distance(vec2);
						float num4;
						bool pathDistanceBetweenAIFaces = Campaign.Current.MapSceneWrapper.GetPathDistanceBetweenAIFaces(faceIndex, faceIndex2, position2D, vec2, 0.2f, maxPathDistance, out num4);
						bool flag = num4 < num3 * euclideanThressholdFactor;
						if (pathDistanceBetweenAIFaces && flag)
						{
							vec = vec2;
							distance = num3;
							vec2 = 0.5f * (vec2 + v);
						}
						else
						{
							v = vec2;
							vec2 = 0.5f * (vec + v);
						}
						faceIndex2 = mapSceneWrapper.GetFaceIndex(vec2);
						num2++;
					}
				}
				return vec;
			}

			// Token: 0x04001964 RID: 6500
			private const float SightOffsetToLoseDeserterParty = 3f;

			// Token: 0x04001965 RID: 6501
			private const float SightRatioToStartEvadingPlayerParty = 0.8f;

			// Token: 0x04001966 RID: 6502
			[SaveableField(1)]
			private MobileParty _deserterMobileParty;

			// Token: 0x04001967 RID: 6503
			[SaveableField(2)]
			private MobileParty _defenderMobileParty;

			// Token: 0x04001968 RID: 6504
			[SaveableField(3)]
			private ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState _currentState;

			// Token: 0x04001969 RID: 6505
			[SaveableField(4)]
			private readonly float _questDifficultyMultiplier;

			// Token: 0x0400196A RID: 6506
			[SaveableField(5)]
			private bool _deserterBattleFinalizedForTheFirstTime;

			// Token: 0x0400196B RID: 6507
			private bool _playerAwayFromSettlementNotificationSent;

			// Token: 0x020007A5 RID: 1957
			private readonly struct ExtortionByDesertersQuestResult
			{
				// Token: 0x06005A8A RID: 23178 RVA: 0x001857E3 File Offset: 0x001839E3
				public ExtortionByDesertersQuestResult(int renownChange, int honorChange, float goldMultiplier, int questGiverRelationChange, int questGiverPowerChange, int townSecurityChange, int townProsperityChange, bool isSuccess)
				{
					this.RenownChange = renownChange;
					this.HonorChange = honorChange;
					this.GoldMultiplier = goldMultiplier;
					this.QuestGiverRelationChange = questGiverRelationChange;
					this.QuestGiverPowerChange = questGiverPowerChange;
					this.TownSecurityChange = townSecurityChange;
					this.TownProsperityChange = townProsperityChange;
					this.IsSuccess = isSuccess;
				}

				// Token: 0x04001FAA RID: 8106
				public readonly int RenownChange;

				// Token: 0x04001FAB RID: 8107
				public readonly int HonorChange;

				// Token: 0x04001FAC RID: 8108
				public readonly float GoldMultiplier;

				// Token: 0x04001FAD RID: 8109
				public readonly int QuestGiverRelationChange;

				// Token: 0x04001FAE RID: 8110
				public readonly int QuestGiverPowerChange;

				// Token: 0x04001FAF RID: 8111
				public readonly int TownSecurityChange;

				// Token: 0x04001FB0 RID: 8112
				public readonly int TownProsperityChange;

				// Token: 0x04001FB1 RID: 8113
				public readonly bool IsSuccess;
			}

			// Token: 0x020007A6 RID: 1958
			internal enum ExtortionByDesertersQuestState
			{
				// Token: 0x04001FB3 RID: 8115
				DesertersMovingToSettlement,
				// Token: 0x04001FB4 RID: 8116
				DesertersRunningAwayFromPlayer,
				// Token: 0x04001FB5 RID: 8117
				DesertersDefeatedPlayer,
				// Token: 0x04001FB6 RID: 8118
				DesertersAreDefeated
			}
		}

		// Token: 0x0200061B RID: 1563
		public class ExtortionByDesertersIssueBehaviorTypeDefiner : SaveableTypeDefiner
		{
			// Token: 0x06004AF6 RID: 19190 RVA: 0x0015A197 File Offset: 0x00158397
			public ExtortionByDesertersIssueBehaviorTypeDefiner() : base(490000)
			{
			}

			// Token: 0x06004AF7 RID: 19191 RVA: 0x0015A1A4 File Offset: 0x001583A4
			protected override void DefineClassTypes()
			{
				base.AddClassDefinition(typeof(ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssue), 1, null);
				base.AddClassDefinition(typeof(ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest), 2, null);
			}

			// Token: 0x06004AF8 RID: 19192 RVA: 0x0015A1CA File Offset: 0x001583CA
			protected override void DefineEnumTypes()
			{
				base.AddEnumDefinition(typeof(ExtortionByDesertersIssueBehavior.ExtortionByDesertersIssueQuest.ExtortionByDesertersQuestState), 3, null);
			}
		}
	}
}
